<script type="text/javascript">
    window.onload = function() {
        var pub = document.getElementById('Public');
        var role = document.getElementById('LnkResourceRole');
        pub.onchange = function () {  if (pub.value == 'Yes') refreshRole(); return false; }  
        role.onchange = function () {  if (role.options.length > 0) pub.value = 'No'; return false; } 
    function refreshRole()
    {
        dojo.xhrGet({
            url: "/admin/json/get-role-options",
            handleAs: "json",
            timeout: 5000,
            load: function(response, ioArgs) {                
                var role = dojo.byId('LnkResourceRole');
                role.options.length = 0;                
                for (index = 0; index < response.length; ++index) {
                    option = response[index];
                    role.options.add(new Option(option.oT, option.oV));
                }      
                return response;
            },
            error: function(response, ioArgs) {
                //alert('Failed xhrGet');
                return response;
            }
        });
    }
    };
</script>
<?php echo $this->form ?>